<?php
/**
 * Created by PhpStorm.
 * User: qttx
 * Date: 2019/5/30
 * Time: 13:56
 */
namespace app\admin\controller;

use app\admin\model\OilServiceModel;

class OilService extends BaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->oilService = new OilServiceModel();
    }
	//加油卡充值列表显示
    public function index()
    {
        $list = $this->oilService->index();
        $page = $list->render();
        $count = count($list);
        $this->assign('list',$list);
        $this->assign('page',$page);
        $this->assign('count',$count);
        return view('oilservice/index');
    }
    
	//充值信息删除
    public function del()
    {
        $res = $this->oilService->del();
        if($res)
        {
            return ['code'=>'1','message'=>'删除成功'];
        }else{
            return ['code'=>'0','message'=>'删除失败'];
        }
    }
	//充值信息多删
    public function dell()
    {
        $res = $this->oilService->dell();
        if($res)
        {
            return ['code'=>'1','message'=>'删除成功'];
        }else{
            return ['code'=>'0','message'=>'删除失败'];
        }
    }
	//充值状态修改
	public function editStatus(){
        $res=$this->oilService->IsStatus(input('id'),input('status'));
        if ($res['code']==1)
            echo "<script>alert('".$res['msg']."')</script>";
        else
            echo "<script>alert('".$res['msg']."')</script>";
        $this->redirect('oilservice/index');
    }
}